﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ASoft.WPF.ViewModel;

namespace ASoft.WPF.View
{
    /// <summary>
    /// HistoryRoomListControl.xaml 的交互逻辑
    /// </summary>
    public partial class HistoryRoomListControl : UserControl
    {
        public HistoryRoomListControl()
        {
            InitializeComponent();
        }

        private void btnExcel_Click(object sender, RoutedEventArgs e)
        {
            var vm = this.DataContext as RoomInfoViewModel;

            var dict = new Dictionary<string, string>();
            dict["时间"] = "时间";
            dict["Id"] = "Id";
            dict["室内温度1"] = "室内温度1";
            dict["室内温度2"] = "室内温度2";
            dict["光照"] = "光照";
            dict["湿度1"] = "湿度1";
            dict["湿度2"] = "湿度2";
            dict["保温被位置"] = "保温被位置";
            dict["灌溉加湿"] = "灌溉加湿";
            dict["湿帘泵位置"] = "湿帘泵位置";
            dict["排风扇"] = "排风扇";
            dict["遮阳网位置"] = "遮阳网位置";

            WPFUtility.ExcelExport(vm.数据集合.Cast<object>().ToList(), dict);

        }
    }
}
